Field of the Invention
Embodiments of the present invention relate generally to fluid simulations and, more specifically, to a mass-conserving Eulerian fluid simulation.
Description of the Related Art
A conventional simulation engine typically implements either a particle-based approach or a grid-based approach when simulating a fluid. With a conventional grid-based approach, the simulation engine generates a grid of nodes, and then computes various dynamic properties of the fluid relative to the grid, including velocity, pressure, density, etc. Fluid properties are typically stored on a staggered grid. For a given node, pressure and density are stored at the center of a cell that surrounds the node. X, Y and Z components of velocity are stored at X, Y and Z faces of the cell respectively. A visual representation of the fluid may then be rendered based on the dynamic properties of the fluid.
One problem with the conventional grid-based approach described above is that the total amount of mass associated with the fluid may fluctuate during the fluid simulation due to numerical errors. Such fluctuations are physically unrealistic and violate basic principles, including the conservation of mass. Consequently, artifacts may appear within the visual representation of the fluid and cause the fluid to appear physically unrealistic.
Accordingly, what is needed in the art is an improved technique for simulating the dynamics of a fluid.